//
// Created by xili on 2024/10/8 11:50.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    void rotate(vector<int> &nums, int k) {
        int n = nums.size();
        k %= n;
        vector<int> ans(n);
        for (int i = 0, j = n - k; i < n; i++, j++) {
            j %= n;
            ans[i] = nums[j];
        }
        nums = ans;
    }
};